%clear all
%clc
F1 = 28;
F2 = 28;
N = F1 + F2;
GT_f1f2 {N + 2 , 3}= {};
 
GT_f1f2 {1,1} = strcat('F1_00',num2str(0));
GT_f1f2 {1,2} = [1:200];
GT_f1f2 {1,3} = [200];
GT_f1f2 {1,4} = [];

for i = 1:F1 -1
    if (i < 10)
        GT_f1f2 {i+1,1} = strcat('F1_00',num2str(i));
    elseif (i >= 10 && i<100)
            GT_f1f2 {i+1,1} = strcat('F1_0',num2str(i)); 
    else
        GT_f1f2 {i+1,1} = strcat('F1_',num2str(i));
    end
    len = length(GT_f1f2{i,2});
    ini = GT_f1f2{i,2}(len) + 1;
    fin = ini + 199;
    GT_f1f2 {i+1,2} = [ ini:fin]; 
    GT_f1f2 {i+1,3} = 200;
end


GT_f1f2 {i+2,1} = strcat('F1_0',num2str(i+1));
len = length(GT_f1f2{i+1,2});
ini = GT_f1f2{i+1,2}(len) + 1;
fin = ini + 79;
GT_f1f2 {i+2,2} =[ ini:fin ];
GT_f1f2 {i+2,3} = 80;
i=i+2;



for j = 0:F2-1
    if (j < 10)
        GT_f1f2 {i+1,1} = strcat('F2_00',num2str(j));
    elseif (j >= 10 && i<100)
        GT_f1f2 {i+1,1} = strcat('F2_0',num2str(j)); 
    else
        GT_f1f2 {i+1,1} = strcat('F2_',num2str(j));
    end
    
    len = length(GT_f1f2{i,2});
    ini = GT_f1f2{i,2}(len) + 1;
    fin = ini + 199;
    
    GT_f1f2 {i+1,2} = [ ini:fin];
    GT_f1f2 {i+1,3} = 200;
i=i+1;
end

GT_f1f2{i+1,1} = strcat('F2_0',num2str(j+1));
len = length(GT_f1f2{i,2});
ini = GT_f1f2{i,2}(len) + 1;
fin = ini + 74;
GT_f1f2 {i+1,2} =[ ini:fin ];
GT_f1f2 {i+1,3} = 75;

%anno_gt_f1f2.m

 for i=1:N+2
     %GT_f1f2 {i,4} =anno_gt_f1f2{i} ;
     GT_f1f2 {i,4} =new_anno_gt_f1f2{i} ;
 end

 lens_f1f2 = [GT_f1f2{:,3}];
 total_frames = sum(lens_f1f2);
 frame_annotations = zeros( sum(lens_f1f2),1 );
 
 
 % 1 : Abnormal
 % 0 : Normal
 for i= 1: length(new_anno_gt_f1f2)
     %length(anno_gt_f1f2{i}); 
     if (length(new_anno_gt_f1f2{i}) ~=0)

         ind = GT_f1f2{i,4} + GT_f1f2{i,2}(1) - 1;
         frame_annotations(ind) = 1;
     end
 
 end
 
 
n_Gp = floor(length(frame_annotations)/10);
Graspoint_annotations = zeros( n_Gp , 1 );
new_Graspoint_annotations = zeros( n_Gp , 1 );
k =0;
for i= 1:10: n_Gp*10
    k = k +1;
    sumi = sum (frame_annotations(i:i+9)==1);
     if (sumi==0)

         Graspoint_annotations (k) = 0;
         new_Graspoint_annotations (k) = 0;
     else
         Graspoint_annotations (k) = 1;
         new_Graspoint_annotations (k) = 1;

     end
 
 end
 %save('Gp_annotationsF1F2.dat', 'Graspoint_annotations', '-ascii');
 save('new_Gp_annotationsF1F2.dat', 'new_Graspoint_annotations', '-ascii');
 
 save('new_frame_annotationsF1F2.dat', 'frame_annotations', '-ascii');